{template 'header'}
<body>
<div class="x-nav">
      <span class="layui-breadcrumb">
        <a href="">首页</a>
        <a href="">金融管理</a>
        <a>
          <cite>收支记录</cite></a>
      </span>
    <a class="layui-btn layui-btn-small" style="line-height:1.6em;margin-top:3px;float:right"
       href="javascript:location.replace(location.href);" title="刷新">
        <i class="layui-icon" style="line-height:30px">ဂ</i></a>
</div>
<div class="x-body">
    <div class="layui-row">
        <form class="layui-form layui-col-md12 x-so" id="search">
            时间:
            <input class="layui-input" autocomplete="off" placeholder="开始日" name="start_time" id="start_time"
                   value="{$_GPC['start_time']}">
            <input class="layui-input" autocomplete="off" placeholder="截止日" name="end_time" id="end_time"
                   value="{$_GPC['end_time']}">
            手机号码:
            <input type="text" name="mobile" placeholder="请输入手机号" autocomplete="off" class="layui-input" id="mobile"
                   value="{$mobile}">
            用户ID:
            <input type="text" name="user_id" placeholder="请输入用户ID" autocomplete="off" class="layui-input" id="user_id"
                   value="{$user_id}">
            <button class="layui-btn" lay-submit="" lay-filter="search"><i class="layui-icon">&#xe615;</i></button>
            收支合计:
            <span style="color:red;font-weight: bolder">{$coin[0]['money']}</span>

        </form>
    </div>
    <xblock>
        <button class="layui-btn layui-btn-radius" onclick="exportUser()"><i class="layui-icon"></i>导出Excel</button>
        <span class="x-right" style="line-height:40px">共有数据：{$total} 条</span>
    </xblock>
    <table class="layui-table x-admin">
        <thead>
        <tr>
            <th>
                <div class="layui-unselect header layui-form-checkbox" lay-skin="primary"><i
                        class="layui-icon">&#xe605;</i></div>
            </th>
            <th>ID</th>
            <th>用户ID</th>
            <th>用户名</th>
            <th>手机号码</th>
            <th>支付宝姓名</th>
            <th>支付宝账户</th>
            <th>类型</th>
            <th>改变金额</th>
            <th>更改后金额</th>
            <th>时间</th>
            <th>备注</th>
        </tr>
        </thead>
        <tbody>
        {if $total==0}

        <tr>
            <td colspan="11" style="text-align: center;">暂无数据</td>
        </tr>

        {else}
        {loop $list $item}
        <tr>
            <td>
                <div class="layui-unselect layui-form-checkbox" lay-skin="primary" data-id='{$item["id"]}'><i
                        class="layui-icon">&#xe605;</i></div>
            </td>
            <td>{$item["id"]}</td>
            <td>{$item["user_id"]}</td>
            <td>{$item["truename"]}</td>
            <td>{$item["mobile"]}</td>
            <td>{$item["alipay_name"]}</td>
            <td>{$item["alipay_account"]}</td>
            <td>
                {if $item['type'] == '-1'}
                <span style="color: red">提现</span>
                {elseif $item['type'] == '+1'}
                <span style="color: green">任务通过</span>
                {elseif $item['type'] == '+2'}
                <span style="color: blue">分销返佣</span>
                {elseif $item['type'] == '+3'}
                <span style="color: orangered">升级返佣</span>
                {elseif $item['type'] == '+4'}
                <span style="color: purple">提现失败</span>
                {/if}
            </td>
            <td>{$item["change"]}</td>
            <td>{$item["balance"]}</td>
            <td>{php echo date('Y-m-d H:i:s',$item["create_time"])}</td>
            <td>{$item['remark']}</td>
        </tr>
        {/loop}
        {/if}
        </tbody>
    </table>
    <div class="page">
        {$pager}
    </div>
</div>
</body>
<script>
    layui.use('form', function () {
        var form = layui.form;

        //监听提交
        form.on('submit(search)', function (data) {
            console.log(data.field)
            var str = '';
            for (var key in data.field) {
                str += key + "=" + data.field[key] + "&";
            }
            var url = '{php echo $this->createWebUrl("user_money_log")}'
            location.href = url + "&" + str;
            return false;
        });
    });

    function exportUser(){
        var str = $('#search').serialize()
        var ids = tableCheck.getData();
        var url = '{php echo $this->createWebUrl("user_money_log_export")}'
        location.href = url + "&" + str + "&ids=" + ids;
    }
    layui.use('laydate', function () {
        var laydate = layui.laydate;

        //执行一个laydate实例
        laydate.render({
            elem: '#start_time' //指定元素
        });

        //执行一个laydate实例
        laydate.render({
            elem: '#end_time' //指定元素
        });
    });


</script>
<script>var _hmt = _hmt || [];
(function () {
    var hm = document.createElement("script");
    hm.src = "https://hm.baidu.com/hm.js?b393d153aeb26b46e9431fabaf0f6190";
    var s = document.getElementsByTagName("script")[0];
    s.parentNode.insertBefore(hm, s);
})();</script>
</body>
</html>